<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-12-12T00:00:00" />
    </reg:owner>
  </owners>

  <number>90502</number>

  <name>Function test for xfi:navigate-relationships</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi:navigate-relationships($source as xs:QName, $linkrole as xs:anyURI, $arcrole as xs:anyURI, $axis as xs:string, $generations as xs:integer, $arcattributes as xs:QName*, $xbrlinstance as element(xbrli:xbrl)) as xs:anyAtomicType*
    </xhtml:p>
    <xhtml:p>
      Please see the examples and formula-testcase-based variations in the companion file, which is in the formula testcase format, <xhtml:a href="90502 xfi.navigate-relationships formula testcase.xml">90502 xfi.navigate-relationships formula testcase.xml</xhtml:a>
    </xhtml:p>
    <xhtml:p>
      For multi-instance use of this function, please see the examples and formula-testcase-based variations in <xhtml:a href="../90601 xfi.xbrl-instance/90601 xfi.xbrl-instance formula testcase.xml">../90601 xfi.xbrl-instance/90601 xfi.xbrl-instance formula testcase.xml</xhtml:a>
    </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666"/>

  <variation id="V-01">
    <name>Presentation descendants, link1, top level, 1 generation</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V01" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V01">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'descendant',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 3 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A1') and
         $result[2] eq QName('http://abc.com/test','A2') and
         $result[3] eq QName('http://abc.com/test','A3')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Presentation descendants, concept not in network</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V02" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V02">
        xfi:navigate-relationships(
           QName('http://abc.com/test','B'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'descendant',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Presentation descendants, concept a leaf node</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V03" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V03">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A111'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'descendant',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Presentation ancestors, 3 generations</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V04" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V04">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A111'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'ancestor',
           3)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 3 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A11') and
         $result[2] eq QName('http://abc.com/test','A1') and
         $result[3] eq QName('http://abc.com/test','A')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Presentation ancestors or self, 4 generations</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V05" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V05">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A111'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'ancestor-or-self',
           3)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 4 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A111') and
         $result[2] eq QName('http://abc.com/test','A11') and
         $result[3] eq QName('http://abc.com/test','A1') and
         $result[4] eq QName('http://abc.com/test','A')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Presentation siblings</name>
    <documentation>
      <xhtml:p>
        This case has the siblings of non-root concepts (mid-tree).
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V06" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V06">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A13'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 2 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A11') and
         $result[2] eq QName('http://abc.com/test','A12')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06a">
    <name>Presentation siblings (at root) link 1</name>
    <documentation>
      <xhtml:p>
        This case has the siblings of root concepts (tree-top), but they should not 'leak' roots
        from other linkrole networks. Here for link1. 
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V06a" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V06a">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06b">
    <name>Presentation siblings for (at root) link 2</name>
    <documentation>
      <xhtml:p>
        Same as V-06a but for link2.
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V06b" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V06b">
        xfi:navigate-relationships(
           QName('http://abc.com/test','B'), 
           'http://abc.com/role/link2',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and 
         $result eq QName('http://abc.com/test','C')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06c">
    <name>Presentation siblings (leaf node)</name>
    <documentation>
      <xhtml:p>
        Same as V-06a but for a leaf node (tree-bottom).
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V06c" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V06c">
        xfi:navigate-relationships(
           QName('http://abc.com/test','B1'), 
           'http://abc.com/role/link2',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and 
         $result eq QName('http://abc.com/test','A2')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Presentation siblings-or-self</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V07" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V07">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A12'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling-or-self',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 3 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A11') and
         $result[2] eq QName('http://abc.com/test','A12') and
         $result[3] eq QName('http://abc.com/test','A13')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07a">
    <name>Presentation siblings-or-self (at root) link1</name>
    <documentation>
      <xhtml:p>
        Same as V-06a but for siblings-or-self
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V07a" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V07a">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling-or-self',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and 
         $result eq QName('http://abc.com/test','A')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07b">
    <name>Presentation siblings-or-self (at root) link2</name>
    <documentation>
      <xhtml:p>
        Same as V-06b but for siblings-or-self
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V07b" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V07b">
        xfi:navigate-relationships(
           QName('http://abc.com/test','B'), 
           'http://abc.com/role/link2',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling-or-self',
           1)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 2 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         ($result[1] eq QName('http://abc.com/test','B') and
          $result[2] eq QName('http://abc.com/test','C')) or
         ($result[1] eq QName('http://abc.com/test','C') and
          $result[2] eq QName('http://abc.com/test','B'))
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07c">
    <name>Presentation sibling-or-abstract-descendant axis</name>
    <documentation>
      <xhtml:p>
        Represents us-gaap pattern where contributing items come from descendants
        when the sibling is abstract.  Here A11 is abstract and its children are
        contributors to be included in treewalk, but A12 is not abstract so its
        children are not included.
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V07c" xlink:type="simple" xlink:href="nav-rel-test-with-abstract.xsd"/>
     <cfcn:call file="V07c">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A13'), 
           'http://abc.com/role/link1',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'sibling-or-abstract-descendant',
           3)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 5 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A11') and
         $result[2] eq QName('http://abc.com/test','A111') and
         $result[3] eq QName('http://abc.com/test','A112') and
         $result[4] eq QName('http://abc.com/test','A113') and
         $result[5] eq QName('http://abc.com/test','A12')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-08">
    <name>Presentation full treewalk from root, all generations</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V08" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V08">
        xfi:navigate-relationships(
           QName('http://www.xbrl.org/2008/function/instance','root'), 
           'http://abc.com/role/link2',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'descendant-or-self',
           0)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 6 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         ($result[1] eq QName('http://abc.com/test','B') and
         $result[2] eq QName('http://abc.com/test','B1') and
         $result[3] eq QName('http://abc.com/test','A2') and
         $result[4] eq QName('http://abc.com/test','C') and
         $result[5] eq QName('http://abc.com/test','C1') and
         $result[6] eq QName('http://abc.com/test','A3')) or
         ($result[1] eq QName('http://abc.com/test','C') and
         $result[2] eq QName('http://abc.com/test','C1') and
         $result[3] eq QName('http://abc.com/test','A3') and      
           $result[4] eq QName('http://abc.com/test','B') and
         $result[5] eq QName('http://abc.com/test','B1') and
         $result[6] eq QName('http://abc.com/test','A2'))
        </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09">
    <name>Definition custom arc treewalk with loop, unlimited generations</name>
    <documentation>
      <xhtml:p>
        Demonstrates that when a descendant (or ancestor) concept repeats in the path from the source, it is not navigated further for unlimited generations navigation (generations=0).  Here navigation starts at A1, for descendants (not self) for unlimited generations.  In this case A1 is not included first in the output (because of missing '-or-self') but A1 is a descendant of A13 (A1-&gt;A13-&gt;A1) so the A1 occurence under A13 is included in the output, but no further navigation from the repeat (directed cycle) beneath A1 is navigated.  (For debugging see V-09a to V-09d.)
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V09">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A1'), 
           'http://abc.com/role/link1',
           'http://abc.com/arcrole/def-test',
           'descendant',
           0)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 9 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A11') and
         $result[2] eq QName('http://abc.com/test','A111') and
         $result[3] eq QName('http://abc.com/test','A112') and
         $result[4] eq QName('http://abc.com/test','A113') and
         $result[5] eq QName('http://abc.com/test','A12') and
         $result[6] eq QName('http://abc.com/test','A121') and
         $result[7] eq QName('http://abc.com/test','A122') and
         $result[8] eq QName('http://abc.com/test','A13') and
         $result[9] eq QName('http://abc.com/test','A1')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09a">
    <name>Definition custom arc treewalk with loop, link2, unlimited generations, no -or-self</name>
    <documentation>
      <xhtml:p>
        Based on V-09 but using link2 (which has no A11 or A12 subtrees, for easier tracing and debugging).
      </xhtml:p>
      <xhtml:p>
        Here for unlimited generations, not '-or-self'.  Should result in A1-&gt;A13-&gt;A1, but only provide A13 and A1 in output sequence.
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09a" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V09a">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A1'), 
           'http://abc.com/role/link2',
           'http://abc.com/arcrole/def-test',
           'descendant',
           0)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 2 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A13') and
         $result[2] eq QName('http://abc.com/test','A1')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09b">
    <name>Definition custom arc treewalk with loop, link2, unlimited generations, with -or-self</name>
    <documentation>
      <xhtml:p>
        Here for unlimited generations, with '-or-self'.  Should result in A1-&gt;A13-&gt;A1, and include A1, A13 and A1 in output sequence (representing order of tree walking including self, the first A1).
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09b" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V09b">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A1'), 
           'http://abc.com/role/link2',
           'http://abc.com/arcrole/def-test',
           'descendant-or-self',
           0)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 3 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A1') and
         $result[2] eq QName('http://abc.com/test','A13') and
         $result[3] eq QName('http://abc.com/test','A1')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09c">
    <name>Definition custom arc treewalk with loop, link2, 7 generations, no -or-self</name>
    <documentation>
      <xhtml:p>
        Specified depth of tree walk generations, including recursion but not -or-self.
        Demonstrates that when a descendant (or ancestor) concept repeats in the path from the source, for a specified generation count the directed cycle continues to be navigated.  Here navigation starts at A1, for descendants (not self) for 7 generations.  In this case A1 is not included first in the output (because of missing '-or-self') but A1 is a descendant of A13 (A1-&gt;A13-&gt;A1), so the actual result shows A13-&gt;A1-&gt;A13-&gt;A1-&gt;A13-&gt;A1-&gt;A13.
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09c" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V09c">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A1'), 
           'http://abc.com/role/link2',
           'http://abc.com/arcrole/def-test',
           'descendant',
           7)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 7 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A13') and
         $result[2] eq QName('http://abc.com/test','A1') and
         $result[3] eq QName('http://abc.com/test','A13') and
         $result[4] eq QName('http://abc.com/test','A1') and
         $result[5] eq QName('http://abc.com/test','A13') and
         $result[6] eq QName('http://abc.com/test','A1') and
         $result[7] eq QName('http://abc.com/test','A13')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-09d">
    <name>Definition custom arc treewalk with loop, link2, 7 generations, with -or-self</name>
    <documentation>
      <xhtml:p>
        Specified depth of tree walk generations, including recursion, with -or-self.
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V09d" xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <cfcn:call file="V09d">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A1'), 
           'http://abc.com/role/link2',
           'http://abc.com/arcrole/def-test',
           'descendant-or-self',
           7)
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 8 and 
         (every $r in $result satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://abc.com/test','A1') and
         $result[2] eq QName('http://abc.com/test','A13') and
         $result[3] eq QName('http://abc.com/test','A1') and
         $result[4] eq QName('http://abc.com/test','A13') and
         $result[5] eq QName('http://abc.com/test','A1') and
         $result[6] eq QName('http://abc.com/test','A13') and
         $result[7] eq QName('http://abc.com/test','A1') and
         $result[8] eq QName('http://abc.com/test','A13')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-10">
    <name>Calculation relations with weights, default link</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <linkbase readMeFirst="true" id="V10" xlink:type="simple" xlink:href="nav-rel-test1-detached-calculation.xml"/>
     <cfcn:call file="V10">
        xfi:navigate-relationships(
           QName('http://abc.com/test','A11'), 
           '',
           'http://www.xbrl.org/2003/arcrole/summation-item',
           'descendant',
           1,
           (QName('','weight')))
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 6 and 
         (every $r in subsequence($result,1,3) satisfies $r instance of xs:QName) and
         (every $r in subsequence($result,4,3) satisfies $r instance of xs:decimal) and
         $result[1] eq QName('http://abc.com/test','A111') and
         $result[2] eq QName('http://abc.com/test','A112') and
         $result[3] eq QName('http://abc.com/test','A113') and
         $result[4] eq 0.5 and
         $result[5] eq 1.25 and
         $result[6] eq -0.45
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-11">
    <name>Presentation relations with preferredLabel, default link</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
     <schema readMeFirst="true" id="V11" xlink:type="simple" xlink:href="MovementsAnalysis.xsd"/>
     <cfcn:call file="V11">
        xfi:navigate-relationships(
           QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','LandBuildingsPresentation'), 
           '',
           'http://www.xbrl.org/2003/arcrole/parent-child',
           'descendant',
           2,
           (QName('','preferredLabel')))
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 14 and 
         (every $r in subsequence($result,1,7) satisfies $r instance of xs:QName) and
         $result[1] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','LandBuildings') and
         $result[2] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','LandBuildingsChangesPresentation') and
         $result[3] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','AdditionsLandBuildings') and
         $result[4] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','DisposalsLandBuildings') and
         $result[5] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','TranslationDifferenceLandBuildings') and
         $result[6] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','TotalChangesLandBuildings') and
         $result[7] eq QName('http://www.UBmatrix.com/Patterns/MovementsAnalysis','LandBuildings') and
         $result[8] eq 'http://www.xbrl.org/2003/role/periodStartLabel' and
         $result[9] eq '' and
         $result[10] eq '' and
         $result[11] eq '' and
         $result[12] eq '' and
         $result[13] eq 'http://www.xbrl.org/2003/role/totalLabel' and
         $result[14] eq 'http://www.xbrl.org/2003/role/periodEndLabel'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-12">
    <name>Sum of descendants of test:A, 3 generations</name>
    <documentation>
      <xhtml:p>
        Same as formula test nav-test-roots2-instance.xml
      </xhtml:p>
     </documentation>
    <inputs>
     <schema xlink:type="simple" xlink:href="nav-rel-test1.xsd"/>
     <instance readMeFirst="true" id="V12" xlink:type="simple" xlink:href="nav-rel-test1-instance.xml"/>
     <cfcn:call file="V12">
        sum( for $item in
               xfi:navigate-relationships(
                  QName('http://abc.com/test','A'), 
                  'http://abc.com/role/link1',
                  'http://www.xbrl.org/2003/arcrole/parent-child',
                  'descendant',
                  3)
               return //*[node-name() eq $item]
            )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq 13181510
      </cfcn:test>
    </outputs>
  </variation>

  <revisions>
    <reg:revision on="2008-12-12T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>





